package com.liezh.bridge.local;

import java.util.HashMap;
import java.util.Map;

/**
 * @author liezh
 * @date 2021-9-2
 */
public class FtpFileUploadExcutor implements LocalFileUploadExcutor {
    @Override
    public Map<String, String> uploadFile(String path, Object file) {
        System.out.println("内网FTP");
        System.out.println("上传地址： " + path);
        System.out.println("文件： "+ file.hashCode());
        // TODO 上传到阿里云OSS, 返回结果
        Map<String, String> result = new HashMap<>(2);
        result.put("key", String.valueOf(file.hashCode()));
        result.put("file", String.valueOf("ftp://127.0.0.1/file/" + file.hashCode()));
        return result;
    }

    @Override
    public boolean checkFile(Object file) {
        System.out.println("文件： "+ file.hashCode());
        System.out.println("校验通过");
        return true;
    }

    @Override
    public String getLocalPath(String key) {
        return "/home/ftp/file/" + key;
    }

    @Override
    public boolean delete(String key) {
        System.out.println("删除本地文件" + key);
        return true;
    }
}
